﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Runtime.Remoting.Contexts;
using System.Text;
using System.Threading.Tasks;
using Data.DBModels;

namespace Data.MyDbContext
{
    class Initializer
    {
    }

    public class ContextInitializer : CreateDatabaseIfNotExists<WebStudioDbContext>
    {

        //public class EntitiesContextInitializer : DropCreateDatabaseIfModelChanges<WebStudioDbContext>
        //{
            protected override void Seed(WebStudioDbContext context)
            {
                //List<Category> categories = new List<Category>
                //{
                //    new Category{ Id = Guid.NewGuid(), CreatedOn = DateTime.Now, Name="News"},
                //    new Category{ Id = Guid.NewGuid(), CreatedOn = DateTime.Now, Name="IT"},
                //    new Category{ Id = Guid.NewGuid(), CreatedOn = DateTime.Now, Name="OnlineStore"}
                //};

                //List<Website> websites = new List<Website> {
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="Yahoo", Url="www.yahoo.ca", Categories= new List<Category>{categories[0]}},
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="Goole", Url="www.google.ca", Categories= new List<Category>{categories[0]}},
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="CBC", Url="www.cbc.ca", Categories= new List<Category>{categories[0]}},
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="NewYokTime", Url="www.nytimes.com", Categories= new List<Category>{categories[0]}}, 
              
                    
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="Microsoft", Url="www.microsoft.com", Categories= new List<Category>{categories[1]}},
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="Asp", Url="www.asp.net", Categories= new List<Category>{categories[1]}},
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="CodeProject", Url="www.codeproject.com", Categories= new List<Category>{categories[1]}},
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="CodePlex", Url="www.codeplex.com", Categories= new List<Category>{categories[1]}},
            

                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="Amazon", Url="www.Amazon.ca", Categories= new List<Category>{categories[2]}},
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="Ebay", Url="www.Ebay.ca", Categories= new List<Category>{categories[2]}},
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="Walmart", Url="www.Walmart.ca", Categories= new List<Category>{categories[2]}},
                //    new Website{ Id=Guid.NewGuid(), CreatedOn=DateTime.Now, Name="Futureshop", Url="www.futureshop.ca", Categories= new List<Category>{categories[2]}}
                
                //};


                //// add data into context and save to db
                //foreach (Website r in websites)
                //{
                //    context.Set<Website>().Add(r);
                //}
                //context.SaveChanges();

            }
        //}
    }
}
